WIP:Expose replace methods 2.x - #2330
Conversation
|
Hey @Amir-61, before I review the code changes, I'd like to discuss the description:
I think they should be mapped on both PUT and PATCH. PUT is needed for backwards compatibility, PATCH is for forward compatibility with LB 3.0 Thoughts?
This does not make much sense to me. I would expect these two methods to be exposed as What do you think?
In my opinion, Also I think the flag should be set directly on |
| * @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object). | ||
| * @param {Object} instance Repalced instance. | ||
| */ | ||
|
|
There was a problem hiding this comment.
I think this methods has a different signature:
function replaceById(id, data, cb);Doesn't it? Please update jsdoc comment too.
|
Please add some unit-tests calling the new REST API endpoints, and also tests to verify the new config options. |
@bajtos Do you think its worth maybe doing all 2.x settings in one setting for futureproofing? I'm proposing something like: Then we can list the options by default when scaffolding models, etc and have it self documenting. Users can simply change the config and get the behaviour without having to dig through too much documentation (only for what is "putMapping v2"). Thoughts? |
|
Closing this PR in favour of #2316 Lets discuss the options for backward compatibility and forward compatibility in the other PR |
@bajtos |
Updated:
Description:
updateAttributesandupdateOrCreateendpoints usePATCH(forward compatibility) andPUT(backward compatibility) verb by default .replaceByIdandreplaceORCreateviaPOSTverb by default.model.settings.options.replaceOnPUTfor2.Xto get3.XbehaviourNote: This patch is for
2.Xto be backported.TODO:
replaceOnPUTfor2.xRelated to #2316 (Implementation for
3.x)Connect to #1979